using System.Linq;
using Provausio.Common.Objects;
using TrainingManagement.api.Models.Data.CRUD;
using TrainingManagement.api.Models.Data.CRUD.TrainingRecord;

namespace TrainingManagement.api.Models.BusinessLogic.TrainingRecord
{
    public class TrainingRecordByRecordIdOperation : BusinessOperation<int, BusinessObjects.TrainingRecord>
    {
        readonly TrainingRecordSelectByRecordIdDataSource _byRecordId = new TrainingRecordSelectByRecordIdDataSource();

        public override BusinessObjects.TrainingRecord Run(int input)
        {
            return _byRecordId.Execute(input).FirstOrDefault();
        }
    }
}